Skip to content

fix(fact-checker-cli): return default system prompt when prompt file is missing - #84

Open
shoemoney wants to merge 1 commit into
perplexityai:mainfrom
shoemoney:fix/fact-checker-default-prompt
Open

fix(fact-checker-cli): return default system prompt when prompt file is missing#84
shoemoney wants to merge 1 commit into
perplexityai:mainfrom
shoemoney:fix/fact-checker-default-prompt

Conversation

@shoemoney

@shoemoney shoemoney commented Aug 24, 2026

Copy link
Copy Markdown

Description

_load_system_prompt in docs/examples/fact-checker-cli/fact_checker.py returns None when the prompt file is missing. The default prompt is only returned from inside the generic except branch, so the FileNotFoundError path prints a warning and falls through with no return value. The repo does not ship a system_prompt.md for this example (the directory contains only README.mdx, fact_checker.py, requirements.txt), so the documented Quick Start command hits this path on every run and silently sends "system": null to the API.

This moves the fallback out of the except block so the default prompt is returned unconditionally whenever loading fails. It matches the structure already used by _load_system_prompt in the sibling example docs/examples/research-finder/research_finder.py.

Type of Contribution

  • Example Tutorial
  • Showcase Project
  • Article/Integration Guide
  • Documentation Update
  • Bug Fix
  • Other (please describe)

Checklist

  • My code follows the cookbook's style guidelines
  • I have included comprehensive documentation
  • I have tested my code and it works as expected
  • I have included all necessary dependencies and setup instructions
  • My MDX file includes proper frontmatter (title, description, keywords)
  • I have linked to any external repositories or live demos

Project Details

What problem does this solve?
Running the fact-checker example as documented sends "system": null to the API because the missing-file path never returns the default prompt.

What makes this contribution valuable to other developers?
The documented Quick Start command no longer sends a null system prompt to the API when no system_prompt.md is present.

Testing

Verified locally: with no system_prompt.md present, the method returned None before and returns the non-empty default prompt string after.

Additional Notes

One file changed: docs/examples/fact-checker-cli/fact_checker.py.

…is missing

_load_system_prompt returned None when system_prompt.md was absent: the
default prompt was only returned from inside the generic except branch,
so the FileNotFoundError path fell through with no return value. The
repo ships no system_prompt.md, so the documented Quick Start sent a
null system prompt on every run.

Move the fallback out of the except block so it returns unconditionally
when loading fails, matching research_finder.py in the sibling example.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant